<template>
	<applyShortTable
		v-if="supplierApplyList.pageCode == 'applyShortTable'"
		:applyListApplyId="applyId"
		:currentAct="currentAct"
	></applyShortTable>
	<sign-preview
		v-else-if="supplierApplyList.pageCode == 'signPreview'"
		:applyId="applyId"
		pageSourceCode="applyList"
		:finType="finType"
	></sign-preview>
	<applyLongTable
		v-else-if="supplierApplyList.pageCode == 'applyLongTable'"
		:applyListApplyId="applyId"
		:currentAct="currentAct"
	></applyLongTable>
	<approvalLongCommit
		v-else-if="supplierApplyList.pageCode == 'approvalLongCommit'"
		:applyId="applyId"
	></approvalLongCommit>
	<accept-preview v-else-if="supplierApplyList.pageCode == 'acceptPreview'" :applyId="applyId"></accept-preview>
	<approvalLongSRMEnd
		v-else-if="supplierApplyList.pageCode == 'approvalLongSRMEnd'"
		:applyId="applyId"
	></approvalLongSRMEnd>
	<applyShortOverInfo
		v-else-if="supplierApplyList.pageCode == 'applyShortOverInfo'"
		:applyId="applyId"
		:currentAct="currentAct"
		:flowNumber="flowNumber"
	></applyShortOverInfo>
	<applyShortPreview
		v-else-if="supplierApplyList.pageCode == 'applyShortPreview'"
		:applyListApplyId="applyId"
	></applyShortPreview>
	<delivery-finance-table
		v-else-if="supplierApplyList.pageCode == 'deliveryFinanceTable'"
		:applyListApplyId="applyId"
		:currentAct="currentAct"
		:mode="mode"
		:flowNumber="flowNumber"
	></delivery-finance-table>
	<delivery-finance-preview
		v-else-if="supplierApplyList.pageCode == 'deliveryFinancePreview'"
		:applyListApplyId="applyId"
		:currentAct="currentAct"
		:mode="mode"
	></delivery-finance-preview>
	<div v-else class="m-view-formDemo m-window">
		<div class="m-condition m-appList">
			<el-row :gutter="10">
				<el-col :span="8">
					<el-date-picker
						@change="focusInput('s_itemNo')"
						v-model="applyDateArr"
						type="daterange"
						range-separator="至"
						start-placeholder="申请日期-开始日期"
						end-placeholder="申请日期-结束日期"
						value-format="yyyy-MM-dd"
					></el-date-picker>
				</el-col>
				<el-col :span="8">
					<el-date-picker
						@change="focusInput('s_itemNo')"
						v-model="financingStartDateArr"
						type="daterange"
						range-separator="至"
						start-placeholder="融资开始-开始日期"
						end-placeholder="融资开始-结束日期"
						value-format="yyyy-MM-dd"
					></el-date-picker>
				</el-col>
				<el-col :span="8">
					<el-date-picker
						@change="focusInput('s_itemNo')"
						v-model="financingEndDateArr"
						type="daterange"
						range-separator="至"
						start-placeholder="融资到期-开始日期"
						end-placeholder="融资到期-结束日期"
						value-format="yyyy-MM-dd"
					></el-date-picker>
				</el-col>
			</el-row>
			<el-row :gutter="10">
				<el-col :span="3">
					<el-input
						placeholder="申请编号"
						clearable
						@keyup.enter.native="query"
						@clear="focusInput('s_itemNo')"
						ref="s_itemNo"
						v-model="searchParams.condition.itemNo"
					></el-input>
				</el-col>
				<el-col :span="3">
					<el-select
						placeholder="是否放款"
						@change="focusInput('s_loanStatus')"
						ref="s_loanStatus"
						v-model="searchParams.condition.loanStatus"
						clearable
					>
						<el-option v-for="(v,i) in loanStateItem" :key="i" :label="v.name" :value="v.code"></el-option>
					</el-select>
				</el-col>
				<el-col :span="3">
					<el-select
						placeholder="到哪一步"
						@change="focusInput('s_currentAct')"
						ref="s_currentAct"
						v-model="searchParams.condition.currentAct"
						clearable
					>
						<el-option v-for="(item,i) in currentActItem" :key="i" :label="item" :value="item"></el-option>
					</el-select>
				</el-col>
				<el-col :span="2">
					<el-button type="primary" @click="query">搜索</el-button>
				</el-col>
				<el-col :span="2">
					<el-button type="primary" @click="scanApply">浏览</el-button>
				</el-col>
				<el-col :span="3">
					<el-button type="primary" @click="lookProcess">查看流程信息</el-button>
				</el-col>
				<el-col :span="2">
					<el-button
						type="danger"
						@click="revocationApply"
						:class="{'isRevocation':isRevocation}"
						:plain="!isRevocation"
						:disabled="!isRevocation"
					>撤销</el-button>
				</el-col>
			</el-row>
		</div>
		<div class="m-agTable m-top2 m-bottom">
			<el-tabs v-model="finType" type="card" @tab-click="handleClick" class="applylist-tabs">
				<el-tab-pane label="金单宝" name="2"></el-tab-pane>
				<el-tab-pane label="金货宝" name="3"></el-tab-pane>
				<el-tab-pane label="天进宝" name="0"></el-tab-pane>
				<el-tab-pane label="月有钱" name="1"></el-tab-pane>
			</el-tabs>
			<ag-grid-vue
				class="m-agTableContent ag-theme-balham ag-apply-list"
				:gridOptions="applyGridOptions"
				:columnDefs="applyColumnDefs"
				:rowData="applyRowData"
				@rowSelected="onRowSelected"
				:defaultColDef="defaultColDef"
			></ag-grid-vue>
			<pagination
				:config="{pageNumberChanged, pageSizeChanged, pageNumber: searchParams.current,justifyContent:'flex-end'}"
				:total="data.total"
			></pagination>
		</div>

		<el-dialog title="查看流程信息" :visible.sync="process" width="80%">
			<!-- 流程图 -->
			<process
				:applyId="applyId"
				:status="isLineEnd"
				:isCus="isCus"
				v-on:dialogclose="processDialogClose"
				:process="process"
			></process>
		</el-dialog>
		<div :class="['t-details-panel',{'f':isBelowCls}]" :style="detailsPanelStyleObject">
			<i class="close" title="关闭" @click="openDetailsPanel = false">X</i>
			<i :class="['arrows',{'below':isBelowCls}]"></i>
			<p>操 作 人 ：{{detailsPanel.dealName}}</p>
			<p>退回时间：{{detailsPanel.prcsDate}}</p>
			<p>
				<span style="color:red;">退回原因：</span>
				{{detailsPanel.note}}
			</p>
		</div>
	</div>
</template>
<style lang="less" scoped>
.t-details-panel {
	position: absolute;
	display: none;
	background: #fff;
	padding: 10px 15px;
	border: 1px solid #ccc;
	color: #000;
	font-weight: 600;
	height: auto;
	height: 200px;
	width: 300px;
	border-radius: 5px;
	box-shadow: 2px 2px 6px #d9ecff;

	&.f {
		box-shadow: -2px -1px 6px #d9ecff;
	}

	i.arrows {
		position: absolute;
		right: 50px;
		top: -15px;

		&:before,
		&:after {
			position: absolute;
			content: "";
			border-top: 8px transparent dashed;
			border-left: 8px transparent dashed;
			border-right: 8px transparent dashed;
			border-bottom: 8px #fff solid;
		}

		&:before {
			border-bottom: 8px #ccc solid;
		}

		&:after {
			top: 1px;
			border-bottom: 8px #fff solid;
		}

		&.below {
			top: 218px;

			&:before,
			&:after {
				border-bottom: none;
				border-top: none;
				border-bottom: 8px transparent dashed;
				border-top: 8px #fff solid;
			}

			&:before {
				border-bottom: none;
				border-top: 8px #ccc solid;
				bottom: -10px;
			}

			&:after {
				top: 1px;
				border-bottom: none;
				border-top: 8px #fff solid;
			}
		}
	}

	p {
		word-break: break-all;
		line-height: 25px;
	}

	i.close {
		position: absolute;
		color: red;
		top: 0;
		right: 5px;
		cursor: pointer;
		font-weight: 600;
	}
}

.m-window {
	/deep/.el-button.el-button--danger.isRevocation {
		color: #fff;
		background-color: #f56c6c;
		border-color: #f56c6c;
	}

	.m-appList {
		/deep/.el-input {
			width: 100% !important;
		}
	}
}

.applylist-tabs {
	/deep/ .el-tabs__item.is-top.is-active {
		background: #409eff;
		color: #fff;
	}
}

.m-agTable {
	top: 110px !important;
	height: calc(100% - 178px);
}

.ag-apply-list {
	/deep/.ag-header-cell:first-child {
		.ag-header-cell-text {
			margin: 0 auto;
		}
	}
}
</style>
<style>
.z-detail {
	display: block;
	width: 280px;
	text-overflow: ellipsis;
	white-space: nowrap;
	overflow: hidden;
}
</style>
<script>
import Pagination from "@/components/pagination.vue";
import gridOptions from "lesso-common/public/gridOptions";
import approvalLongSRMEnd from "./approvalLongSRMEnd";
import applyShortOverInfo from "./applyShortOverInfo";
import applyShortPreview from "./applyShortPreview";
import DeliveryFinancePreview from "./common/deliveryFinancePreview";
import DeliveryFinanceTable from "./common/deliveryFinanceTable";
import { mapState, mapActions, mapGetters } from "vuex";
import ApplyShortTable from "./applyShortTable";
import applyLongTable from "./applyLongTable";
import approvalLongCommit from "./approvalLongCommit";
import { formatPrice } from "@/util/format";
import eventBus from "@/util/event-bus";
/**
 * @group financeManager
 * 我的申请
*/
export default {
	name: "applyList",
	data () {
		return {
			isBelowCls: false,
			openDetailsPanel: false,
			detailsPanel: {
				actName: "",
				prcsDate: "",
				dealName: "",
				note: ""
			},
			detailsPanelStyleObject: {
				top: "",
				left: "",
				display: ""
			},
			currentActItem: [
				"供应商发起融资",
				"供应商提交申请表",
				"供应商签署",
				"联塑金融受理",
				"联塑金融审批",
				"联塑金融放款",
				"供应商还款",
				"已完成",
				"已退回",
				"已撤销",
				"已失效"
			],
			financingStartDateArr: [], //融资开始日期
			financingEndDateArr: [], //融资到期日期
			applyId: "",
			currentAct: "",
			flowNumber: "", //申请流程编号
			applyListInf: {},
			loading: true,
			applyDateArr: [], //申请日期
			isRowData: "", //选中某行的数据
			isEdit: true, //是否可编辑
			isRevocation: false, //是否可撤销
			revocationCode: "", //撤销申请-环节code
			loanStateItem: [
				{
					name: "未放款",
					code: 0
				},
				{
					name: "已放款",
					code: 1
				}
			],
			defaultColDef: {
				resizable: true
			},
			applyGridOptions: {},
			applyColumnDefs: [
				{
					headerName: "申请编号",
					field: "itemNo",
					checkboxSelection: true //是否显示复选框
				},
				{
					headerName: "申请日期",
					field: "createTime",
					valueFormatter: params => {
						return this.formatDate(params.value);
					}
				},
				{
					headerName: "流程标题",
					field: "itemName"
				},
				{
					headerName: "到哪一步",
					field: "currentAct",
					valueFormatter: params => {
						if (params.value) {
							return params.value == '供应商还款' ? '待还款' : params.value;
						}
					}
				},
				{
					headerName: "操作人",
					field: "operator"
				},
				{
					headerName: "融资金额",
					field: "applyAmt",
					valueFormatter: params => {
						return formatPrice(params.value);
					}
				},
				{
					headerName: "融资开始日期",
					field: "applyDate",
					valueFormatter: params => {
						return this.formatDate(params.value);
					}
				},
				{
					headerName: "融资到期日期",
					field: "prepaybackDate",
					valueFormatter: params => {
						return this.formatDate(params.value);
					}
				},
				{
					headerName: "是否放款",
					field: "loanStatusCH"
				},
				{
					headerName: "备注",
					width: 300,
					cellRenderer: ({ data }) => {
						if (data.currentAct == "已退回") {
							return `<a class="z-detail" title="点击查看退回详情"><span style="color:red;">退回原因：</span>${data.note}</a>`;
						}
						return "";
					},
					onCellClicked: ({ event, data }) => {
						if (data.currentAct == "已退回") {
							this.detailsPanel.note = data.note;
							this.detailsPanel.prcsDate = data.prcsDate;
							this.detailsPanel.dealName = data.operator;
							this.openDetailsPanel = true;

							//const wsize = remote.getCurrentWindow().getSize()
							//const w_y = wsize[1] / 1.1
							const clientHeight =
								(document.documentElement.clientHeight ||
									document.body.clientHeight) / 1.1;
							let t = event.clientY - 99 - event.offsetY + 26;
							if (event.clientY + 200 > clientHeight) {
								t = event.clientY - 99 - event.offsetY - 245;
								this.isBelowCls = true;
							} else {
								this.isBelowCls = false;
							}
							const leftNavWidth = 168;
							const cellWidth = 300;
							this.detailsPanelStyleObject.top = t + "px";
							this.detailsPanelStyleObject.left =
								event.clientX - leftNavWidth - event.offsetX - cellWidth + "px";
						}
					}
				}
			],
			applyRowData: [],
			searchParams: {
				condition: {
					finType: 2,
					custId: 0,
					itemName: "",
					loanStatus: null,
					startDate: "",
					endDate: "",
					isDone: 2,
					currentAct: null
				},
				current: 1,
				size: 10
			},
			data: {
				total: 0
			},
			finType: "2", // 融资类型 0 - 天进宝 1-月有钱 2-金单宝 3-金货宝
			process: false, //判断流程图的显隐
			isLineEnd: false, //判断流程是完成状态还是退回状态
			isCus: true, //判断是供应商查询还是金融查询
			mode: ''
		};
	},
	props: {
		addTab: {
			type: Function
		}
	},
	created () {
		this.changePageCode("");
		this.applyGridOptions = Object.assign({
			onRowSelected: this.onRowSelected
		}, gridOptions({ singleSelection: true }))
		//console.log('SRMindexData=',this.supplierApplyList.SRMindexData)
		//SRMindexData从index页面调用
		if (this.supplierApplyList.SRMindexData) {
			this.$nextTick(_ => {
				this.scanApply();
			})
		}
	},
	mounted () {
		eventBus.$on("clickDFTab", tab => {
			if (tab.content == "applyList") {
				this.query();
			}
		});
	},
	beforeMount () {
		this.searchParams.condition.custId = this.supplyChainFinance.custInf.custId;
		this.getPageListByCust();
	},
	computed: {
		...mapState(["supplyChainFinance", "supplierApplyList"]),
		...mapGetters(["changePageCodeStatus", "changePageSRMindexData"])
	},
	watch: {
		openDetailsPanel (newValue, oldValue) {
			if (!newValue) {
				this.detailsPanelStyleObject.display = "none";
			} else {
				this.detailsPanelStyleObject.display = "block";
			}
		},
		changePageCodeStatus: function (old, newd) {
			if (old != newd) {
				//清空选中列表数据
				this.rowData = [];
				this.isEdit = true;
				this.isRevocation = false;
				this.revocationCode = "";
				//重新刷新列表
				this.getPageListByCust();
			}
		},
		changePageSRMindexData: function (old, newd) {
			if (old != newd) {
				if (this.supplierApplyList.SRMindexData) {
					this.scanApply();
				}
			}
		}
	},
	methods: {
		...mapActions(["changePageCode", "changeFromPage", 'changeSRMindexData']),
        /**
		 * @vuese
		 * 关闭查看退回信息弹窗
		*/
		closeDetailsPanel () {
			this.openDetailsPanel = false;
		},
        /**
		 * @vuese
		 * 关闭查看流程信息弹窗
		*/
		processDialogClose () {
			this.process = false;
		},
        /**
		 * @vuese
		 * 跳转到月有钱申请界面
		*/
		addTabs () {
			this.addTab(
				{
					cName: "月有钱",
					name: "applyLong",
					completed: false
				},
			);
		},
        /**
		 * @vuese
		 * 撤销融资申请
		*/
		revocationApply () {
			this.$confirm("是否确认撤销该申请？").then(_ => {
				let param = {
					applyId: this.applyId,
					code: this.revocationCode
				};
				this.$http
					.revocationApply(param)
					.then(({ data }) => {
						if (data.code == 200) {
							this.isRevocation = false;
							this.isEdit = true;
							this.revocationCode = "";
							this.getPageListByCust();
							this.$alert(data.info, {
								confirmButtonText: "确定",
								customClass: "alertSuccess"
							});
						} else {
							this.$alert(`撤销申请失败，${data.info}`, {
								confirmButtonText: "确定",
								customClass: "alertFailure"
							});
						}
					})
					.catch(error => {
						this.$alert("撤销申请失败！，请检查网络！", {
							confirmButtonText: "确定",
							customClass: "alertFailure"
						});
					});
			});
		},
        /**
		 * @vuese
		 * 获取我的申请列表数据
		*/
		async getPageListByCust () {
			let that = this;
			this.isEdit = true;
			this.isRevocation = false;
			that.loading = true;
			that.applyGridOptions.overlayNoRowsTemplate = "&nbsp;";
			this.searchParams.condition.currentAct =
				this.searchParams.condition.currentAct == ""
					? null
					: this.searchParams.condition.currentAct;
			this.searchParams.condition.startDate = this.applyDateArr
				? this.applyDateArr[0]
				: "";
			this.searchParams.condition.endDate = this.applyDateArr
				? this.applyDateArr[1]
				: "";
			this.searchParams.condition.applyStartDate = this.financingStartDateArr
				? this.financingStartDateArr[0]
				: "";
			this.searchParams.condition.applyEndDate = this.financingStartDateArr
				? this.financingStartDateArr[1]
				: "";
			this.searchParams.condition.paybackStartDate = this.financingEndDateArr
				? this.financingEndDateArr[0]
				: "";
			this.searchParams.condition.paybackEndDate = this.financingEndDateArr
				? this.financingEndDateArr[1]
				: "";

			await that.$http
				.getPageListByCust(that.searchParams)
				.then(({ data }) => {
					//that.loading = false;
					if (data.code == 200) {
						that.applyRowData = data.rows;
						that.data.total = data.total;
						let gridOption = this.applyGridOptions;
						if (data.rows.length == 0) {
							that.applyGridOptions.overlayNoRowsTemplate = "暂无数据";
						}
						setTimeout(function () {
							let allColumnIds = [];
							if (gridOption.columnApi) {
								let num = gridOption.columnApi.getAllColumns().length;
								gridOption.columnApi.getAllColumns().forEach(function (column) {
									--num;
									if (num > 0) {
										allColumnIds.push(column.colId);
									}
								});
								gridOption.columnApi.autoSizeColumns(allColumnIds);
							}
						});
					} else {
						//this.loading = false;
						this.$alert(`获取数据失败：${data.info}`, {
							confirmButtonText: "确定",
							customClass: "alertFailure"
						});
					}
				})
				.catch(error => {
					//this.loading = false;
					this.$alert("查询列表明细失败，请检查网络！", {
						confirmButtonText: "确定",
						customClass: "alertFailure"
					});
				});
		},
        /**
		 * @vuese
		 * 页码改变回调
         * @arg 参数pageNumber为当前页码
		*/
		pageNumberChanged (pageNumber) {
			this.searchParams.current = pageNumber;
			this.getPageListByCust();
		},
        /**
		 * @vuese
		 * 每页显示条数改变回调
         * @arg 参数pageSize为当前每页显示条数
		*/
		pageSizeChanged (pageSize) {
			this.searchParams.current = 1;
			this.searchParams.size = pageSize;
			this.getPageListByCust();
		},
        /**
		 * @vuese
		 * 查询申请单数据
		*/
		query () {
			this.closeDetailsPanel();
			this.searchParams.current = 1;
			this.getPageListByCust();
		},
		/**
		 * @vuese
		 * 浏览融资申请详情
		*/
		scanApply () {
			let rows = [];
			this.closeDetailsPanel();
			let rowData = '';
			if (this.isRowData) {
				rowData = this.isRowData;
				rows.push(this.isRowData)
			} else if (this.supplierApplyList.SRMindexData) {
				rowData = this.supplierApplyList.SRMindexData;
				rows.push(this.supplierApplyList.SRMindexData)
			}
			if (rows.length == 0) {
				this.$alert(`提示：请选择一条你需要浏览的数据`, {
					showClose: false,
					confirmButtonText: "确定",
					customClass: "alertPrompt"
				});
				return;
			}
			this.applyListInf = rowData;
			this.applyId = rowData.ID;
			this.flowNumber = rowData.itemNo;
			this.supplyChainFinance.role = rowData;
			//环节 联塑金融受理、供应商提交申请表、供应商签署、联塑金融审批、联塑金融放款、供应商还款、结束
			// let finType = rowData.finType; //融资类别
			if (rowData.finType) {
				this.finType = rowData.finType == '天进宝' ? '0' : rowData.finType == '月有钱' ? 1 : rowData.finType == '金单宝' ? '2' : '3'
			}
			let currentAct = rowData.currentAct; //当前环节
			this.currentAct = currentAct;
			let pageCode;
			if (this.finType == "0") {
				// switch (currentAct) {
				//   case "联塑金融受理":
				//     pageCode = "acceptPreview"; //确认融资后预览页面
				//     break;
				//   case "联塑金融审批":
				//     pageCode = "applyShortTable";
				//     break;
				//   case "供应商提交申请表":
				//     pageCode = "applyShortTable"; //提交天进宝申请表页面
				//     break;
				//   case "已完成":
				//     pageCode = "applyShortTable";
				//     break;
				//   case "已退回":
				//     pageCode = "applyShortTable";
				//     break;
				//   default:
				//     pageCode = "signPreview"; //供应商签署页面
				if (currentAct == "联塑金融受理") {
					pageCode = "acceptPreview"; //确认融资后预览页面
				} else if (
					currentAct == "联塑金融审批" ||
					currentAct == "供应商提交申请表"
				) {
					pageCode = "applyShortTable"; //提交天进宝申请表页面
				} else if (
					currentAct.includes("完成") ||
					currentAct.includes("退回") ||
					currentAct.includes("撤销") ||
					currentAct.includes("失效")
				) {
					pageCode = "applyShortOverInfo"; //短融结束页面
				} else if (currentAct == "供应商发起融资") {
					pageCode = "applyShortPreview";
				} else {
					pageCode = "signPreview"; //供应商签署页面
				}
			} else if (this.finType == '1') {
				// switch (currentAct) {
				//   case "联塑金融受理":
				//     pageCode = "acceptPreview"; //确认融资后预览页面
				//     break;
				//   case "联塑金融审批":
				//     pageCode = "applyLongTable";
				//   case "供应商提交申请表":
				//     pageCode = "applyLongTable"; //提交月有钱申请表页面
				//     break;
				//   case "已完成":
				//     pageCode = "applyLongTable";
				//     break;
				//   case "已退回":
				//     pageCode = "applyLongTable";
				//     break;
				//   default:
				//     pageCode = "approvalLongCommit"; //金融审批提交申请表页面
				// }
				if (currentAct == "联塑金融受理") {
					pageCode = "acceptPreview"; //确认融资后预览页面
				} else if (
					currentAct == "联塑金融审批" ||
					currentAct == "供应商提交申请表"
				) {
					pageCode = "applyLongTable"; //提交天进宝申请表页面
				} else if (
					currentAct.includes("完成") ||
					currentAct.includes("退回") ||
					currentAct.includes("撤销")
				) {
					pageCode = "approvalLongSRMEnd"; //长融结束页面
				} else {
					pageCode = "approvalLongCommit"; //供应商签署页面
				}
			} else if (this.finType == '3' || this.finType == '2') {
				this.mode = this.finType == '3' ? 'delivery' : 'order'
				if (currentAct == "联塑金融受理") {
					pageCode = "acceptPreview"; //确认融资后预览页面
				} else if (
					currentAct == "联塑金融审批" ||
					currentAct == "供应商提交申请表"
				) {
					pageCode = "deliveryFinanceTable"; //提交金单宝
				} else if (
					currentAct.includes("完成") ||
					currentAct.includes("退回") ||
					currentAct.includes("撤销") ||
					currentAct.includes("失效") ||
					currentAct.includes("供应商还款")
				) {
					pageCode = "deliveryFinanceTable"; //短融结束页面
				} else if (currentAct == "供应商发起融资") {
					pageCode = "deliveryFinancePreview";
				} else {
					pageCode = "signPreview"; //供应商签署页面
				}
			}
			// let pageCode = rowData.currentAct == '供应商提交申请表'? 'applyShortTable': 'signPreview'
			this.changePageCode(pageCode);
			this.changeFromPage("applyList");
			this.changeSRMindexData('')
			this.isRowData = ''
		},
        /**
		 * @vuese
		 * 选择行事件回调获取已选择行数据
		*/
		onRowSelected (row) {
			this.closeDetailsPanel();
			// this.isRowData = row;
			let selectRow = this.applyGridOptions.api.getSelectedRows().length;
			this.isRowData = this.applyGridOptions.api.getSelectedRows()[0];
			if (this.isRowData && selectRow == 1) {
				this.isEdit = false;
				if (
					this.isRowData.currentAct == "已退回" ||
					this.isRowData.currentAct == "已撤销"
				) {
					this.isLineEnd = true;
				} else {
					this.isLineEnd = false;
				}
				if (
					this.isRowData.currentAct == "供应商提交申请表" ||
					this.isRowData.currentAct == "供应商发起融资"
				) {
					// if (this.isRowData.finType == "天进宝" || this.finType == '3' || this.finType == '2') {
					// 	this.isRevocation = true;
					// }
					this.isRevocation = true;
					this.revocationCode = "act_cust_commit";
				} else if (this.isRowData.currentAct == "供应商签署") {
					if (this.isRowData.finType == "天进宝" || this.finType == '3' || this.finType == '2') {
						this.isRevocation = true;
					}
					this.revocationCode = "act_cust_sign";
				} else {
					this.revocationCode = "";
					this.isRevocation = false;
				}
				let applyId = this.isRowData.ID;
				this.applyId = applyId;
			} else {
				this.isEdit = true;
				this.revocationCode = "";
				this.isRevocation = false;
			}
		},
		/**
		 * @vuese
		 * 格式化数据为"yyyy-MM-dd"
		*/
		formatDate (time) {
			if (time) {
				return time.substring(0, 10);
			} else {
				return "";
			}
		},
		/**
		 * @vuese
		 * 点击tab标签回调
         * @arg 参数tab为当前tab标签编码
		*/
		handleClick (tab, event) {
			this.closeDetailsPanel();
			// console.log(tab, event);
			this.searchParams.current = 1;
			this.isRevocation = false;
			this.isEdit = true;
			this.finType = tab.name;
			this.searchParams.condition.finType = tab.name;
			this.query();
		},
		/**
		 * @vuese
		 * 查看流程信息
		*/
		lookProcess () {
			let rows = this.applyGridOptions.api.getSelectedRows();
			if (rows.length == 0 || rows.length > 1) {
				this.$alert(`提示：请选择一条你需要查看的数据`, {
					showClose: false,
					confirmButtonText: "确定",
					customClass: "alertPrompt"
				});
				return;
			}
			this.closeDetailsPanel();
			this.process = true;
			//this.$tap.$emit('getLineProFn')
		},
        /**
		 * @vuese
		 * 表单获取焦点回调
         * @arg 参数refName为表单名称
		*/
		focusInput (refName) {
			if (refName === "s_currentAct" || refName === "s_loanStatus") {
				this.query();
				return;
			}
			this.$refs[refName].focus();
		}
	},
	components: {
		Pagination,
		ApplyShortTable,
		applyLongTable,
		approvalLongCommit,
		approvalLongSRMEnd,
		applyShortOverInfo,
		applyShortPreview,
		DeliveryFinancePreview,
		DeliveryFinanceTable
	}
};
</script>